module.exports = {
  loadFont(family, source) {
    return new Promise((resolve, reject) => {
      uni.loadFontFace({
        source: source,
        family: family,
        global: true,
        success: resolve,
        fail: reject
      });
    });
  },
  loadFonts(fonts) {
    let loadfonts = [];
    for (let [family, source] of Object.entries(fonts || {})) {
      loadfonts.push(this.loadFont(family, source));
    }
    return Promise.all(loadfonts);
  },
  hideLoading() {
    return uni.hideLoading();
  },
  hideToast() {
    return uni.hideToast();
  },
}
